/* NOTE: This do file replicates results from the main paper */

/* NOTE:  For replication, you must first run ROC.do before running this program. */ 


/* TABLE 1.2 */

tab prime_minister if prime_minister & caretaker==0 & pm_nonparty==0 & cabmajparty==0 & hos_monarch==0 & pr_nonparty==0 & hos_interim==0 & hos_election & hos_nomin
tab prime_minister if prime_minister & caretaker==0 & pm_nonparty==0 & cabmajparty==0 & hos_monarch==0 & pr_nonparty==0 & hos_interim==0 & hos_election & !hos_nomin
tab prime_minister if prime_minister & caretaker==0 & pm_nonparty==0 & cabmajparty==0 & hos_monarch==0 & pr_nonparty==0 & hos_interim==0 & !hos_election & hos_nomin
tab prime_minister if prime_minister & caretaker==0 & pm_nonparty==0 & cabmajparty==0 & hos_monarch==0 & pr_nonparty==0 & hos_interim==0 & !hos_election & !hos_nomin


/* TABLE 2 */

tab prime_minister largest_party if prime_minister  & caretaker==0 & pm_nonparty==0 & cabmajparty==0 & hos_monarch==0 & pr_nonparty==0 & hos_interim==0
tab prime_minister largest_party if prime_minister & caretaker==0 & pm_nonparty==0 & cabmajparty==0 & hos_monarch==0 & pr_nonparty==0 & hos_interim==0 & party_name!="Independents" & cd_index >1 & cd_index < 2
tab prime_minister largest_party if prime_minister & caretaker==0 & pm_nonparty==0 & cabmajparty==0 & hos_monarch==0 & pr_nonparty==0 & hos_interim==0 & party_name!="Independents" & cd_index >=2 & cd_index < 3
tab prime_minister largest_party if prime_minister & caretaker==0 & pm_nonparty==0 & cabmajparty==0 & hos_monarch==0 & pr_nonparty==0 & hos_interim==0 & party_name!="Independents" & cd_index >=3


/* TABLE 3: 2 >= CD-INDEX  < 3 */ 

mixlogit prime_minister largest_party median_party if caretaker==0 & pm_nonparty==0 & cabmajparty==0 & hos_monarch==0 & pr_nonparty==0 & hos_interim==0 & cd_index >= 2 & cd_index < 3 & party_name!="Independents", rand(incumbentpm_party ) group(cabinet_id) nrep(200)
calcROC
estimates store model1

mixlogit prime_minister largest_party median_party prparty if caretaker==0 & pm_nonparty==0 & cabmajparty==0 & hos_monarch==0 & pr_nonparty==0 & hos_interim==0 & cd_index >= 2 & cd_index < 3 & party_name!="Independents", rand(incumbentpm_party) group(cabinet_id) nrep(200)
calcROC
estimates store model2
lrtest model2 model1, force

mixlogit prime_minister largest_party median_party prparty_direct if caretaker==0 & pm_nonparty==0 & cabmajparty==0 & hos_monarch==0 & pr_nonparty==0 & hos_interim==0 & cd_index >= 2 & cd_index < 3 & party_name!="Independents", rand(incumbentpm_party prparty_indirect) group(cabinet_id) nrep(200)
calcROC
estimates store model3
lrtest model3 model1, force

mixlogit prime_minister largest_party median_party prparty_proactive prparty_reactive if caretaker==0 & pm_nonparty==0 & cabmajparty==0 & hos_monarch==0 & pr_nonparty==0 & hos_interim==0 & cd_index >= 2 & cd_index < 3 & party_name!="Independents", rand(incumbentpm_party) group(cabinet_id) nrep(200)
calcROC
estimates store model4
lrtest model4 model1, force

mixlogit prime_minister largest_party median_party prparty_pro_direl prparty_re_direl prparty_re_parl if caretaker==0 & pm_nonparty==0 & cabmajparty==0 & hos_monarch==0 & pr_nonparty==0 & hos_interim==0 & cd_index >= 2 & cd_index < 3 & party_name!="Independents", rand (incumbentpm_party prparty_pro_parl) group(cabinet_id) nrep(200)
calcROC
estimates store model5
lrtest model5 model1, force


/* TABLE 4: CD-INDEX  >= 3*/  

mixlogit prime_minister largest_party median_party if caretaker==0 & pm_nonparty==0 & cabmajparty==0 & hos_monarch==0 & pr_nonparty==0 & hos_interim==0 & cd_index >=3 & party_name!="Independents", rand (incumbentpm_party) group(cabinet_id) nrep(200)
calcROC
estimates store model1

mixlogit prime_minister largest_party median_party if caretaker==0 & pm_nonparty==0 & cabmajparty==0 & hos_monarch==0 & pr_nonparty==0 & hos_interim==0 & cd_index >=3 & party_name!="Independents", rand (incumbentpm_party prparty) group(cabinet_id) nrep(200)
calcROC
estimates store model2
lrtest model2 model1, force

mixlogit prime_minister  median_party prparty_indirect if caretaker==0 & pm_nonparty==0 & cabmajparty==0 & hos_monarch==0 & pr_nonparty==0 & hos_interim==0 & cd_index >=3 & party_name!="Independents", rand (largest_party incumbentpm_party prparty_direct) group(cabinet_id) nrep(200)
calcROC
estimates store model3
lrtest model3 model1, force

mixlogit prime_minister median_party prparty_proactive if caretaker==0 & pm_nonparty==0 & cabmajparty==0 & hos_monarch==0 & pr_nonparty==0 & hos_interim==0 & cd_index >=3 & party_name!="Independents", rand (largest_party incumbentpm_party prparty_reactive) group(cabinet_id) nrep(200)
calcROC
estimates store model4
lrtest model4 model1, force

mixlogit prime_minister median_party prparty_pro_direl prparty_pro_parl prparty_re_parl if caretaker==0 & pm_nonparty==0 & cabmajparty==0 & hos_monarch==0 & pr_nonparty==0 & hos_interim==0 & cd_index >=3 & party_name!="Independents", rand (largest_party incumbentpm_party prparty_re_direl) group(cabinet_id) nrep(200)
calcROC
estimates store model5
lrtest model5 model1, force


/* Figure 1 */

gen pipe = "|"
gen where = -2
histogram cd_index_categories if caretaker==0 & pm_nonparty==0 & cabmajparty==0 & prime_minister & hos_monarch==0 & pr_nonparty==0 & hos_interim==0, discrete percent bfcolor(gold) blcolor(black) xlabel(1(1)8) ylabel(0(5)40) plot(scatter where cd_index, ms(none) mlabel(pipe) mlabpos(0))xtitle(Party system domination (CD Index)) ytitle(Government Formations (%)) ytitle(, height(7)) xtitle(, height(7))legend(off)


